//
//  CTEmojiDetailsCell.m
//  ConstellationTalk_0.1
//
//  Created by riley on 15/6/12.
//  Copyright (c) 2015年 riley chu. All rights reserved.
//

#import "CTEmojiDetailsCell.h" 
#import "CTDebugManager.h"
#import "CTRequestUtil.h"
#import "CTPublishItems.h"

@interface CTEmojiDetailsCell()
{
    UIImageView         *picImageView;
}

@end

@implementation CTEmojiDetailsCell

- (void)dealloc
{
    [CTDebugManager showDebugLogInfo:@"dealloc : CTEmojiDetailsCollection Is Removed!!!"];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12.5,17.5 , 60, 60)];
        picImageView.image = [UIImage imageNamed:@"head"];
        [self addSubview:picImageView];
    }
    return self;
}
#pragma  mark -setter-
- (void)setPicImageView:(NSString *)imgUrl
{
    [CTRequestUtil requestImgWithUrl:imgUrl withCompletionSuccessHandler:^(UIImage *img) {
        
        picImageView.image = img;

    } withFailedHandler:^(NSError *error) {
        
    }];
}

-(void)setBubbleItem:(CTEditeBubbleListItem *)bubbleItem
{
    if (bubbleItem.image == nil) {
        [CTRequestUtil requestImgWithUrl:bubbleItem.url withCompletionSuccessHandler:^(UIImage *img) {
            
            picImageView.image = img;
            
        } withFailedHandler:^(NSError *error) {
            
        }];
    }else{
        picImageView.image = bubbleItem.image;
    }
}

@end
